home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Online / Epic4 / share / epic / help / 6_functions / shift < prev    next >
Text File  |  2001-03-21  |  1KB  |  33 lines

  1. Synopsis:
  2.    $shift(<variable name>)
  3.    $unshift(<variable name> <word> [<word> ...])
  4.  
  5. Technical:
  6.    These functions are used to add or remove words to or from the beginning
  7.    of a variable.  The $shift() function removes the first word (and any
  8.    space padding) from the beginning of the variable and returns the word.
  9.    The $unshift() function prepends the given string to the variable, and
  10.    returns the resultant string.
  11.  
  12.    Note that the variable name itself must be used, without any leading
  13.    '$' character.
  14.  
  15. Practical:
  16.    These functions are more efficient means of adding or removing data to
  17.    or from a variable than assigning the variable's value to itself.  They
  18.    are identical to the SHIFT and UNSHIFT commands, except that they also
  19.    have return values.
  20.  
  21. Returns:
  22.    shift:   word "shifted" off of the variable
  23.    unshift: resultant string after function call
  24.  
  25. Examples:
  26.    $unshift(foo blah)             prepends "blah" to $foo
  27.    $shift(foo)                    removes "blah" from $foo and returns it
  28.    $unshift(foo bar  booya)       prepends "bar  booya" to $foo
  29.  
  30. See Also:
  31.    pop(6); push(6); shift(5); unshift(5)
  32.  
  33.